import http from "@/api";

/**
 * 系统部门树形列表
 */
export const deptTreeApi = (params: object) => {
    return http.get(`/dept/tree`, params);
};

/**
 * 系统部门树形缓存
 */
export const deptTreeCacheApi = () => {
    return http.get(`/dept/tree/cache`);
};

/**
 * 新增部门
 * @param params
 */
export const addDeptApi = (params: object) => {
    return http.post(`/dept/add`, params);
};

/**
 * 编辑部门
 * @param params
 */
export const editDeptApi = (params: any) => {
    return http.put(`/dept/edit/${params.id}`, params);
};

/**
 * 切换部门状态
 * @param id
 */
export const changeStatusApi = (id: number) => {
    return http.put(`/dept/change_status/${id}`);
};

/**
 * 修改排序
 * @param params
 */
export const changeSortApi = (params: object) => {
    return http.post(`/dept/changeSort`, params);
};

/**
 * 删除部门
 * @param id
 */
export const deleteDeptByIdApi = (id: number) => {
    return http.delete(`/dept/delete/${id}`);
};

/**
 * 批量删除
 * @param params
 */
export const deleteDeptApi = (params: object) => {
    return http.post(`/dept/delete`, params);
};
